package com.wwdeng.smart.video.presenter

import com.wwdeng.smart.base.BasePresenter
import com.wwdeng.smart.video.iview.IPreviewView
import org.json.JSONObject
import kotlin.random.Random

/**
 * android
 * @Author：wwdeng
 * @CreateTime：2024/9/16 16:36
 * <pre>
 * 视频预览类逻辑处理
 * </pre>
 */
class PreviewPresenter(private val iView: IPreviewView): BasePresenter() {

    /**
     * 展示实时视频
     */
    fun checkRealTimeVideo(){


    }

    /**
     * 展示云回放视频
     */
    fun checkCloudVideo(){


    }

    /**
     * 展示卡回放视频
     */
    fun checkCardVideo(){


    }

    /**
     * 加载实时视频
     */
    fun loadRealTimeVideoAction(){
        val videoUrl = ""

        iView.showCheckTypeNormal()
        iView.showRealTimeViews(videoUrl)
    }

    /**
     * 加载云回放视频列表
     */
    fun loadCloudVideoListAction(){
        val videoList = arrayListOf<JSONObject>()
        for (i in 0..Random.nextInt(10)){
            val item = JSONObject()
            item.put("id",i+1)
            item.put("imgUrl","https://img1.baidu.com/it/u=1075362846,1567972572&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=500")
            item.put("videoTitle","cloudVideo$i")
            item.put("videoDuration","00:30")
            videoList.add(item)
        }
        iView.showCheckTypeNormal()
        iView.showRecordingCloudViews(videoList)
    }

    /**
     * 加载卡回放视频列表
     */
    fun loadCardVideoListAction(){
        val videoList = arrayListOf<JSONObject>()
        for (i in 0..Random.nextInt(10)){
            val item = JSONObject()
            item.put("id",i+1)
            item.put("imgUrl","https://img0.baidu.com/it/u=2362080143,1604641904&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313")
            item.put("videoTitle","cardVideo")
            item.put("videoDuration","01:00")
            videoList.add(item)
        }
        iView.showCheckTypeNormal()
        iView.showRecordingCardViews(videoList)
    }

}